package com.jfl.service.impl.system;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.jfl.system.SysCacheService;

/**
 * SysCache Service
 *  
 * @author  赵炎
 * @version  [V1.00, 2018年12月6日]
 * @since V1.00
 */
@Component
@Service(version="${jfl.version}")
public class SysCacheServiceImpl implements SysCacheService
{
    private static final Logger LOG = LoggerFactory.getLogger(SysCacheServiceImpl.class);
    
    @Override
    public void flush()
    {
        if (SysCacheServiceImpl.LOG.isDebugEnabled())
        {
            LOG.debug("清除缓存开始");
        }
        // CacheUtil.getCache().del(Constants.CACHE_NAMESPACE + "*");
        if (SysCacheServiceImpl.LOG.isDebugEnabled())
        {
            LOG.debug("清除缓存结束");
        }
    }

    @Override
    public void flush(Map<String, String> param)
    {
        String key = param.get("key");
        // CacheUtil.getCache().delAll(Constants.CACHE_NAMESPACE + "*" + key + "*");
        if (key.contains("Permission"))
        {
            //CacheUtil.getCache().delAll(Constants.CACHE_NAMESPACE + "*shiro_redis_cache*");
        }

        if (SysCacheServiceImpl.LOG.isDebugEnabled())
        {
            LOG.debug("清除缓存[{}]开始", key);
        }
        
        if (SysCacheServiceImpl.LOG.isDebugEnabled())
        {
            LOG.debug("清除缓存[{}]结束", key);
        }
    }
    
}
